_require local "../../../../basis.smi"
_require local "../../../extensions/debug/main/Bug.smi"
(* _require local "../../../libs/env/main/SEnv.smi" *)
(* _require local "../../../libs/env/main/SSet.smi" *)

(* _require local "../../../compilerIRs/absyn/main/Fixity.smi" *)

_require "./TfunVars.smi"
_require local "../../../libs/list-utils/main/ListSorter.smi"
_require "../../../libs/ids/main/LocalID.smi"
_require "../../../data/symbols/main/Symbol.smi"
_require "../../../data/control/main/Control.smi"
(* _require "../../../data/symbols/main/RecordLabel.smi" *)
(* _require "../../../data/runtimetypes/main/RuntimeTypes.ppg.smi" *)
_require "../../../compilerIRs/patterncalc/main/PatternCalc.ppg.smi"
_require "../../../compilerIRs/patterncalc/main/PatternCalcInterface.ppg.smi"
_require "../../../compilerIRs/absyn/main/AbsynTy.smi"
_require local "../../../compilerIRs/absyn/main/AbsynTyFormatter.smi"
_require "../../../compilerIRs/idcalc/main/IDCalc.ppg.smi"
_require "../../../data/builtin/main/BuiltinPrimitive.ppg.smi"
_require "../../../data/types/main/TvarMap.smi"
_require "../../../data/types/main/Types.ppg.smi"
_require "../../../data/symbols/main/Loc.smi"

_require "./NameEvalEnv.ppg.smi"


structure NameEvalUtils =
  struct
    val print : string -> unit
    val printProp : IDCalc.property -> unit
    val printSymbol : Symbol.symbol -> unit
    val printLongsymbol : Symbol.longsymbol -> unit
    val printPath : string list -> unit
    val printTvar : IDCalc.tvar -> unit
    val printTvarId : TvarID.id -> unit
    val printVarId : VarID.id -> unit
    val printVarInfo : IDCalc.varInfo -> unit
    val printInterfaceId : InterfaceID.id -> unit
    val printTy : IDCalc.ty -> unit
    val printPITy : AbsynTy.ty -> unit
    val printTstr : NameEvalEnv.tstr -> unit
    val tstrToString : NameEvalEnv.tstr -> string
    val printTyE : NameEvalEnv.tstr SymbolEnv.map -> unit
    val printConSpec : IDCalc.ty option SymbolEnv.map -> unit
    val printTfun : IDCalc.tfun -> unit
    val printTfunkind : IDCalc.tfunkind -> unit
    val printIdstatus : IDCalc.idstatus -> unit
    val idstatusToString : IDCalc.idstatus -> string
    val printTypId : TypID.id -> unit
    val printConId : ConID.id -> unit
    val printPrimitive : BuiltinPrimitive.primitive -> unit
    val printLiftedTys : TvarSet.set -> unit
    val printTypInfo : {id:TypID.id, path:string list} -> unit
    val printTySubst
        : ({id:TypID.id, path:string list} * TvarSet.set)
              TypID.Map.map
              -> unit
    val printTypidSet : TypID.Set.set -> unit
    val printSubst : {conIdS:IDCalc.idstatus ConID.Map.map,
                      exnIdS:ExnID.id ExnID.Map.map,
                      tvarS:IDCalc.ty TvarMap.map}
                     -> unit
    val printTfvSubst : IDCalc.tfunkind ref TfvMap.map -> unit
    val printEnv : NameEvalEnv.env -> unit
    val printStrEntry : NameEvalEnv.strEntry -> unit
    val printTopEnv : NameEvalEnv.topEnv -> unit
    val printFunE : NameEvalEnv.funE -> unit
    val printFunEEntry : NameEvalEnv.funEEntry -> unit
    val printVar : IDCalc.varInfo -> unit
    val printExp : IDCalc.icexp -> unit
    val printPat : IDCalc.icpat -> unit
    val printDecl : IDCalc.icdecl -> unit
    val printPlstrDecl : PatternCalc.plstrdec -> unit
    val printPlstrexp : PatternCalc.plstrexp -> unit
    val printPlsigexp : PatternCalc.plsigexp -> unit
    val printPitopdec : PatternCalcInterface.pitopdec -> unit
    val printPltopdec : PatternCalc.pltopdec -> unit
    val printPidec : PatternCalcInterface.pidec -> unit
    val printPiinterfacedec : PatternCalcInterface.interfaceDec -> unit
    val printCastEnv
        : {conIdEnv:'a,
           tfunEnv:(IDCalc.tfun * 'b * IDCalc.tfun) TypID.Map.map,
           tvarEnv:IDCalc.ty TvarMap.map}
          -> unit
    val printReverseMap
        : {LiftDown:{arity:int, liftedTys:TvarSet.set,
                     path:string list} TypID.Map.map,
           ToTy:({id:TypID.id, path:string list}
                 * TvarSet.set) TvarMap.map}
          -> unit
    val printCastMap
        : {arity:'a, liftedTys:TvarSet.set,
           newId:TypID.id, tyname:string} TypID.Map.map
          -> unit
    val printTfv : IDCalc.tfunkind ref -> unit
    val printTfvList : (IDCalc.tfunkind ref * string list) list -> unit
    val printTfvMap : string list TfvMap.map -> unit
    val printCompileUnit : PatternCalcInterface.compile_unit -> unit
    val printLoc : Loc.loc -> unit
    val printCompileUnitSpliced : PatternCalcInterface.compile_unit_spliced -> unit
    val evalList : {emptyEnv:'a, eval:'b -> 'a * 'c, unionEnv:'a * 'a -> 'a}
                   -> 'b list -> 'a * 'c list
    val evalTailList : {env:'a, eval:'a -> 'b -> 'a * 'c}
                       -> 'b list -> 'a * 'c list
    val SymbolEnvToSymbolSet : 'a SymbolEnv.map -> SymbolSet.set
    val staticTfunName : NameEvalEnv.env list * IDCalc.tfun -> string
    val staticTyConName : NameEvalEnv.env list * Types.tyCon -> string
  end
